

package com.hazelcast.client.impl.protocol.codec.builtin;

import com.hazelcast.client.impl.protocol.ClientMessage;

import java.time.OffsetDateTime;
import java.util.List;

import static com.hazelcast.client.impl.protocol.codec.builtin.FixedSizeTypesCodec.OFFSET_DATE_TIME_SIZE_IN_BYTES;

public final class ListCNOffsetDateTimeCodec {

    private ListCNOffsetDateTimeCodec() {
    }

    public static void encode(ClientMessage clientMessage, Iterable<OffsetDateTime> items) {
        ListCNFixedSizeCodec.encode(clientMessage, items, OFFSET_DATE_TIME_SIZE_IN_BYTES, FixedSizeTypesCodec::encodeOffsetDateTime);
    }

    public static List<OffsetDateTime> decode(ClientMessage.ForwardFrameIterator iterator) {
        return decode(iterator.next());
    }

    public static List<OffsetDateTime> decode(ClientMessage.Frame frame) {
        return ListCNFixedSizeCodec.decode(frame, OFFSET_DATE_TIME_SIZE_IN_BYTES, FixedSizeTypesCodec::decodeOffsetDateTime);
    }
}
